<template>
  <!-- 登录 -->
  <div>
    <el-table class="partition" border :data="manageData" style="width: 100%">
      <el-table-column align="center" type="index" width="50" label="序号"></el-table-column>
      <el-table-column prop="name" label="类型"> </el-table-column>
      <el-table-column prop="date" label="添加时间"> </el-table-column>
      <el-table-column align="center" fixed="right" label="操作" width="100">
        <template slot-scope="scope">

          <el-button @click="deleteMange(scope.row._id)" type="text" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { getType, deleteType } from "../../api/type";
export default {
  name: "typeCreate",
  components: {},
  data () {
    return {
      manageData: [],
    };
  },
  methods: {
    // 提交登录
    getManage () {
      getType().then((res) => {
        if (res.success) {
          this.manageData = res.result;
        }
      });
    },
    deleteMange (id) {
      deleteType(id).then((res) => {
        if (res.success) {
          this.getManage();
        }
      });
    },
  },
  mounted () {
    this.getManage();
  },
};
</script>
<style scoped></style>
